package com.kimi.abyss.rbac.api.dto;

import com.kimi.abyss.rbac.api.pojo.SysRole;
import com.kimi.abyss.rbac.api.pojo.SysUser;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;
import java.util.List;

/**
 * no-op
 *
 * @author kimi
 * @date 2021/7/19
 */
@Data
@ToString
@NoArgsConstructor
public class UserInfo implements Serializable {

    private SysUser sysUser;

    private List<SysRole> sysRoles;

    private String[] permissions;

    public UserInfo(SysUser sysUser) {
        this.sysUser = sysUser;
    }

    public <R extends SysRole> UserInfo(SysUser sysUser, List<R> sysRoles) {
        this.sysUser = sysUser;
//        this.sysRoles = sysRoles;
        this.sysRoles = (List<SysRole>) sysRoles;
    }

    public void setSysRoles(List<SysRole> sysRoles) {
        this.sysRoles = sysRoles;
    }

}
